#include <REGX52.H>
#include "Delay.h"
#include "MatrixLED.h"
#include "Timer0.h"

unsigned char Offset=0;
unsigned char Animation[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,	 
0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
0x15,0x15,0x09,0x00,0x7F,0x01,0x02,0x00,
0x7F,0x01,0x02,0x00,0x0E,0x11,0x11,0x0E,
0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,	
};

void main()
{
	unsigned char i;
	MatrixLED_Init();
	Timer0_Init();
	
	while(1)
	{
		for(i=0;i<8;i++)
		{
			MatrixLED_ShowColumn(i,Animation[i+Offset]);
		}
		
		
	}
	
}


void Timer0_Routine() interrupt 1  //定时器0的中断函数
{
	static unsigned int T0Count;//static静态局部变量，只有本函数能引用
	//退出函数不丢失T0Count变量
	
	TL0 = 0x18;		//设置定时初值
	TH0 = 0xFC;		//设置定时初值
	T0Count++;
	if(T0Count>=150)
	{
		Offset++;
		if(Offset>40)
			Offset=0;
		//清零重记次
		T0Count=0;
	}
	
}
